#include<iostream>
#include<cstdio>
using namespace std;
int a[100000];
int acd(int a, int b)
{
	while (a % b)
	{
		int s;
		s = a;
		a = b;
		b = s % b;
	}
	return b;
}
int main()
{
	int t, n;
	cin >> t;
	while (t--)
	{
		cin >> n;
		cin >> a[1]>>a[2];
		a[2] =a[2]/ acd(a[2], a[1]);
		for (int i = 3; i <= n; i++)
		{
			cin >> a[i];
			a[2] = a[2] / acd(a[2], a[i]);
		}
		if (a[2] == 1)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}